import { ensureUser } from '../../middleware/validators'
import * as forms from './controller'

export const baseUrl = '/forms'

export default [
  {
    method: 'POST',
    route: '/',
    handlers: [
      ensureUser,
      forms.createForm
    ]
  },
  {
    method: 'GET',
    route: '/:id',
    handlers: [
      ensureUser,
      forms.getForm
    ]
  },
  {
    method: 'GET',
    route: '/',
    handlers: [
      ensureUser,
      forms.getForms
    ]
  },
  {
    method: 'PUT',
    route: '/:id',
    handlers: [
      ensureUser,
      forms.getForm,
      forms.updateForm
    ]
  },
  {
    method: 'POST',
    route: '/:id/single/',
    handlers: [
      forms.dynamicData
    ]
  }
]
